package
{
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	
	public class AssetsToLayaMan
	{
		private static var _ins:AssetsToLayaMan;
		public static function get ins():AssetsToLayaMan
		{
			if(!_ins){
				_ins = new AssetsToLayaMan();
			}
			return _ins;
		}
		
		public var mTimer:Timer;
		private var urlArr:Array = [];
		private var curTime:int;
		
		public function AssetsToLayaMan()
		{
			mTimer = new Timer(16);
			mTimer.addEventListener(TimerEvent.TIMER, onTimerEvent);
			mTimer.start();
		}
		public function pushPath(path:String):void
		{
			urlArr.push(path);
		}
		private function onTimerEvent(e:TimerEvent):void
		{
			var time:int = new Date().time;
			if(time - curTime < 60){
				if(urlArr.length){
					var path:String = urlArr.shift();
					AssetsToLaya.printMsg.text = "正在转换，还剩余：" + urlArr.length + "，path=" + (path.split("mobile\\")[1]);
					new AssetsToLaya().doLoad(path);
				}
				else{
					AssetsToLaya.printMsg.text = "转换完成！";
				}
			}
			curTime = time;
		}
	}
}